﻿using System;

public class Mapper002 : MapperDefault
{
    public override void init(NES nes)
    {
        base.init(nes);
    }

    public override void loadROM(ROM rom)
    {
        if (rom.Valid)
        {
            this.loadRomBank(0, 0x8000);
            this.loadRomBank(rom.RomBankCount - 1, 0xc000);
            this.loadCHRROM();
            base.nes.Cpu.requestIrq(2);
        }
    }

    public override void write(int address, short value_Renamed)
    {
        if (address < 0x8000)
        {
            base.write(address, value_Renamed);
        }
        else
        {
            this.loadRomBank(value_Renamed, 0x8000);
        }
    }
}

